import 'composition.dart';

class Competitor {
  String? code;
  String? type;
  String? organisation;
  Composition? composition;

  Competitor({this.code, this.type, this.organisation, this.composition});

  factory Competitor.fromJson(Map<String, dynamic> json) => Competitor(
        code: json['Code'] as String?,
        type: json['Type'] as String?,
        organisation: json['Organisation'] as String?,
        composition: json['Composition'] == null
            ? null
            : Composition.fromJson(json['Composition'] as Map<String, dynamic>),
      );

  Map<String, dynamic> toJson() => {
        'Code': code,
        'Type': type,
        'Organisation': organisation,
        'Composition': composition?.toJson(),
      };
}
